package com.ztgf.order.service;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.ztgf.order.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.order.mapper.OrderProcessLogMapper;
import com.ztgf.order.models.service.IOrderProcessLogService;
import com.ztgf.order.models.bo.OrderProcessLogSaveBO;
import com.ztgf.order.models.dto.OrderProcessLogDTO;

/**
 * 订单过程日志表控制器
 *
 * @author YUE
 * @Date 2020-07-06 19:53:09
 */
@DubboService
public class OrderProcessLogServiceImpl extends ServiceImpl<OrderProcessLogMapper, OrderProcessLogDTO> implements IOrderProcessLogService{

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public boolean add(OrderProcessLogSaveBO saveBO) {
        OrderProcessLogDTO dto = new OrderProcessLogDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }
    public boolean addByOrderInfo(Long orderId,Integer status) {
        OrderProcessLogDTO dto = new OrderProcessLogDTO();
        dto.setOrderId(orderId);
        dto.setStatus(status);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }
}
